<template>
	<view class="container">
		<view class="f_header position-relative" :style="'background-image: url(' + baseUrl + '/static/oval.png);'">
			<view :style="'padding-top:' + (StatusBar + 10) + 'px;'">
				<view @click="toPage('/filePage/pages/news/news')" class="cu-avatar round margin-left-sm" :style="
            'background-image:url(' +
            baseUrl +
            '/static/news.png);width: 44rpx;height: 46rpx;'
          ">
					<view class="cu-tag badge" v-if="userInfo.messageCount > 0" style="right: 20rpx; top: -6rpx">
						{{ userInfo.messageCount }}
					</view>
				</view>
			</view>
			<view @click="
          toPage(
            '/filePage/pages/personal-information/personal-information?userInfo=' +
              JSON.stringify(userInfo)
          )
        " class="radius10 bg-white padding flex justify-between align-center"
				style="position: absolute; bottom: -48rpx; right: 20rpx; left: 20rpx">
				<view v-if="isLogin" class="flex justify-start align-center f-grow1">
					<image :src="userInfo.userIcon" mode="" class="round" style="width: 100rpx; height: 100rpx"></image>
					<view class="f-grow1 margin-left-sm">
						<view class="flex justify-start align-center">
							<view class="text-bold text-17 text-221815">
								{{ userInfo.nickname }}
							</view>
							<view v-if="userInfo.mechanicStatus" class="text-11 margin-left-sm text-white" style="
                  background: #ed7200;
                  border-radius: 17px 17px 17px 3px;
                  padding: 6rpx 10rpx;
                ">
								技工
							</view>
							<view v-if="userInfo.courierStatus" class="text-11 margin-left-xs text-white" style="
                  background: #ed7200;
                  border-radius: 17px 17px 17px 3px;
                  padding: 6rpx 10rpx;
                ">
								配送工
							</view>
							<view v-if="userInfo.providerStatus" class="text-11 margin-left-xs text-white" style="
                  background: #ed7200;
                  border-radius: 17px 17px 17px 3px;
                  padding: 6rpx 10rpx;
                ">
								服务商
							</view>
							<view v-if="userInfo.operatorStauts" class="text-11 margin-left-xs text-white" style="
                  background: #ed7200;
                  border-radius: 17px 17px 17px 3px;
                  padding: 6rpx 10rpx;
                ">
								运营商
							</view>
						</view>
						<view style="line-height: 30rpx"
							class="flex justify-start align-center text-sm text-999 margin-top-sm">
							<block v-if="userInfo.userIdentityStatus == 1">
								<image :src="baseUrl + '/static/Verified.png'" mode=""
									style="width: 26rpx; height: 28rpx"></image>
								<view class="margin-left-xs"> 已实名 </view>
							</block>
							<view v-else @click.stop="toPage('/filePage/pages/real-name/real-name')"
								class="margin-left-xs" style="color: #007aff; font-weight: bold">
								还未实名认证
							</view>
							<view class="margin-left-sm flex align-center" style="height: 100%">
								Id: {{ userInfo.id }}
							</view>
						</view>
					</view>
				</view>
				<view v-else class="flex justify-start align-center f-grow1" @click="toPage">
					<image :src="baseUrl + '/static/image.png'" mode="" class="round"
						style="width: 100rpx; height: 100rpx"></image>
					<view class="f-grow1 margin-left-sm"> 登陆/注册 </view>
				</view>
				<image :src="baseUrl + '/static/righted.png'" mode="" style="width: 14rpx; height: 14rpx">
				</image>
			</view>
		</view>
		<scroll-view scroll-x="true" class="scroll margin-sm radius10 no-border" style="margin-top: 68rpx">
			<view class="item" @click="toPage('/filePage/pages/order/order?title=普通订单')">
				<view class="cu-item flex flex-direction justify-center align-center" style="padding: 0">
					<view class="" :style="
              'position:relative;background-image:url(' +
              baseUrl +
              '/static/order.png);width: 60rpx;height: 60rpx;background-size: 100% 100%;'
            ">
						<view class="cu-tag badge" v-if="orderServiceCount > 0">
							{{ orderServiceCount >= 99 ? "99+" : orderServiceCount }}
						</view>
					</view>
					<text class="text-sm">普通订单</text>
				</view>
			</view>
			<view class="item" @click="toPage('/filePage/pages/order/order?title=配送订单')">
				<view class="cu-item flex flex-direction justify-center align-center" style="padding: 0">
					<view class="" :style="
              'position:relative;background-image:url(' +
              baseUrl +
              '/static/Delivery.png);width: 60rpx;height: 60rpx;background-size: 100% 100%;'
            ">
						<view class="cu-tag badge" v-if="courierCount">{{
              courierCount >= 99 ? "99+" : courierCount
            }}</view>
					</view>
					<text class="text-sm">配送订单</text>
				</view>
			</view>
			<view class="item" @click="
          toPage('/filePage/pages/bidding-order/bidding-order?title=竞标订单')
        ">
				<view class="cu-item flex flex-direction justify-center align-center" style="padding: 0">
					<view class="" :style="
              'position:relative;background-image:url(' +
              baseUrl +
              '/static/Bidding.png);width: 60rpx;height: 60rpx;background-size: 100% 100%;'
            ">
						<view class="cu-tag badge" v-if="competitiveCount > 0">
							{{ competitiveCount >= 99 ? "99+" : competitiveCount }}
						</view>
					</view>
					<text class="text-sm">竞标订单</text>
				</view>
			</view>
			<view class="item" @click="toPage('/filePage/pages/mall-order/mall-order?title=商城订单')">
				<view class="cu-item flex flex-direction justify-center align-center" style="padding: 0">
					<view class="" :style="
              'position:relative;background-image:url(' +
              baseUrl +
              '/static/Mall.png);width: 60rpx;height: 60rpx;background-size: 100% 100%;'
            ">
						<view class="cu-tag badge" v-if="productCount > 0">{{
              productCount >= 99 ? "99+" : productCount
            }}</view>
					</view>
					<text class="text-sm">商城订单</text>
				</view>
			</view>
			<view class="item" @click="toPage('/filePage/pages/screen-order/screen-order')">
				<view class="cu-item flex flex-direction justify-center align-center" style="padding: 0">
					<view class="" :style="
              'position:relative;background-image:url(' +
              baseUrl +
              '/static/installation.png);width: 60rpx;height: 60rpx;background-size: 100% 100%;'
            ">
						<view class="cu-tag badge" v-if="screenCount > 0">{{
              screenCount >= 99 ? "99+" : screenCount
            }}</view>
					</view>
					<text class="text-sm">大屏订单</text>
				</view>
			</view>
			<view class="item" @click="toPage('/filePage/pages/group-order/group-order')">
				<view class="cu-item flex flex-direction justify-center align-center" style="padding: 0">
					<view class="" :style="
              'position:relative;background-image:url(' +
              baseUrl +
              '/static/group2.png);width: 60rpx;height: 60rpx;background-size: 100% 100%;'
            ">
						<view class="cu-tag badge" v-if="groupBuyCount > 0">
							{{ groupBuyCount >= 99 ? "99+" : groupBuyCount }}
						</view>
					</view>
					<text class="text-sm">团购订单</text>
				</view>
			</view>
		</scroll-view>
		<view class="margin-sm padding bg-white radius10">
			<view class="flex justify-between align-center">
				<view class="text-15 text-bold text-221815"> 我的钱包 </view>
				<view class="flex justify-start align-center" @click.stop="toPage('/filePage/pages/wallet/wallet')">
					<view class="text-sm text-999 margin-right-xs"> 进入钱包 </view>
					<image :src="baseUrl + '/static/right.png'" mode="" style="width: 14rpx; height: 14rpx">
					</image>
				</view>
			</view>
			<view class="flex justify-around align-center" style="margin-top: 60rpx">
				<view class="flex flex-direction align-center justify-center"
					@click.stop="toPage('/filePage/pages/wallet/wallet')">
					<view class="text-sm text-333"> 余额 </view>
					<view class="text-221815 margin-top-sm">
						<text class="text-20 text-bold">{{
              parseFloat(userInfo.balance / 100).toFixed(2) || 0
            }}</text><text class="text-xs"></text>
					</view>
					<view class="text-11 text-999 margin-top-sm"> 含保证金 </view>
				</view>
				<view v-if="userInfo.operatorStauts" @click.stop="toPage('/filePage/pages/wallet/wallet')"
					class="flex flex-direction align-center justify-center">
					<view class="text-sm text-333"> 保证金 </view>
					<view class="text-221815 margin-top-sm">
						<text class="text-20 text-bold">{{
              parseFloat(userInfo.depositAmount / 100).toFixed(2) || 0
            }}</text><text class="text-xs"></text>
					</view>
					<view class="text-11 text-999 margin-top-sm"> 不可消费 </view>
				</view>
				<view class="flex flex-direction align-center justify-center"
					@click="toPage('/filePage/pages/points-mall/points-mall')">
					<view class="text-sm text-333"> 积分 </view>
					<view class="text-221815 margin-top-sm">
						<text class="text-20 text-bold">{{ userInfo.points || 0 }}</text><text class="text-xs"></text>
					</view>
					<view class="text-11 text-999 margin-top-sm"> 兑换奖励 </view>
				</view>
				<view @click.stop="toPage('/filePage/pages/wallet/wallet')"
					class="flex flex-direction align-center justify-center">
					<view class="text-sm text-333"> 信用分 </view>
					<view class="text-221815 margin-top-sm">
						<text class="text-20 text-bold">{{ userInfo.credit || 0 }}</text><text class="text-xs"></text>
					</view>
					<view class="text-11 text-999 margin-top-sm"> 不可消费 </view>
				</view>
			</view>
		</view>
		<view class="margin-sm padding bg-white radius10">
			<view class="flex justify-between align-center">
				<view class="text-15 text-bold text-221815"> 认证中心 </view>
			</view>
			<view class="flex justify-between align-center" style="margin-top: 60rpx">
				<view class="flex justify-between align-center">
					<view v-if="!userInfo.mechanicStatus" class="" @click="
              toPage('/filePage/pages/certification-center/mechanic/mechanic')
            ">
						<view class="text-df text-333"> 技工 </view>
						<view class="margin-top-xs color flex justify-start align-center">
							<view class="text-sm margin-right-xs"> 我要去认证 </view>
							<image :src="baseUrl + '/static/right.png'" mode="" style="width: 14rpx; height: 14rpx">
							</image>
						</view>
					</view>
					<view class="" v-else @click="
              toPage('/filePage/pages/certification-center/mechanic/mechanic')
            ">
						<view class="text-df text-333"> 技工 </view>
						<view class="margin-top-xs flex justify-start align-center">
							<view class="text-999 text-sm margin-right-xs">
								<text>已认证</text>
								<text>去管理</text>
							</view>
							<image :src="baseUrl + '/static/right.png'" mode="" style="width: 14rpx; height: 14rpx">
							</image>
						</view>
					</view>
					<image :src="baseUrl + '/static/Mechanic.png'" mode="" style="width: 94rpx; height: 94rpx"></image>
				</view>
				<view class="flex justify-between align-center">
					<view v-if="!userInfo.courierStatus" class="" @click="
              toPage(
                '/filePage/pages/certification-center/delivery-worker/delivery-worker'
              )
            ">
						<view class="text-df text-333"> 配送工 </view>
						<view class="margin-top-xs color flex justify-start align-center">
							<view class="text-sm margin-right-xs"> 我要去认证 </view>
							<image :src="baseUrl + '/static/right.png'" mode="" style="width: 14rpx; height: 14rpx">
							</image>
						</view>
					</view>
					<view class="" v-else @click="
              toPage(
                '/filePage/pages/certification-center/delivery-worker/delivery-worker'
              )
            ">
						<view class="text-df text-333"> 配送工 </view>
						<view class="margin-top-xs flex justify-start align-center">
							<view class="text-999 text-sm margin-right-xs">
								<text>已认证</text>
								<text>去管理</text>
							</view>
							<image :src="baseUrl + '/static/right.png'" mode="" style="width: 14rpx; height: 14rpx">
							</image>
						</view>
					</view>
					<image :src="baseUrl + '/static/Delivery_worker.png'" mode="" style="width: 94rpx; height: 94rpx">
					</image>
				</view>
			</view>
			<view class="flex justify-between align-center" style="margin-top: 60rpx">
				<view class="flex justify-between align-center">
					<view v-if="!userInfo.providerStatus" class="" @click="
              toPage(
                '/filePage/pages/certification-center/service-center/service-center'
              )
            ">
						<view class="text-df text-333"> 服务商 </view>
						<view class="margin-top-xs color flex justify-start align-center">
							<view class="text-sm margin-right-xs"> 我要去认证 </view>
							<image :src="baseUrl + '/static/right.png'" mode="" style="width: 14rpx; height: 14rpx">
							</image>
						</view>
					</view>
					<view class="" v-else @click="
              toPage(
                '/filePage/pages/certification-center/service-center/service-center'
              )
            ">
						<view class="text-df text-333"> 服务商 </view>
						<view class="margin-top-xs flex justify-start align-center">
							<view class="text-999 text-sm margin-right-xs">
								<text>已认证</text>
								<text>去管理</text>
							</view>
							<image :src="baseUrl + '/static/right.png'" mode="" style="width: 14rpx; height: 14rpx">
							</image>
						</view>
					</view>
					<image :src="baseUrl + '/static/Service_provider.png'" mode="" style="width: 94rpx; height: 94rpx">
					</image>
				</view>
				<view class="flex justify-between align-center">
					<view v-if="!userInfo.operatorStauts" class="" @click="
              toPage('/filePage/pages/certification-center/operator/operator')
            ">
						<view class="text-df text-333"> 运营商 </view>
						<view class="margin-top-xs color flex justify-start align-center">
							<view class="text-sm margin-right-xs"> 我要去认证 </view>
							<image :src="baseUrl + '/static/right.png'" mode="" style="width: 14rpx; height: 14rpx">
							</image>
						</view>
					</view>
					<view class="" v-else @click="
              toPage('/filePage/pages/certification-center/operator/operator')
            ">
						<view class="text-df text-333"> 运营商 </view>
						<view class="margin-top-xs flex justify-start align-center">
							<view class="text-999 text-sm margin-right-xs">
								<text>已认证</text>
								<text>去管理</text>
							</view>
							<image :src="baseUrl + '/static/right.png'" mode="" style="width: 14rpx; height: 14rpx">
							</image>
						</view>
					</view>
					<image :src="baseUrl + '/static/Operator.png'" mode="" style="width: 94rpx; height: 94rpx">
					</image>
				</view>
			</view>
		</view>
		<view class="margin-sm padding bg-white radius10" v-if="userInfo.mechanicStatus">
			<view class="flex justify-between align-center">
				<view class="text-15 text-bold text-221815"> 技工管理 </view>
				<view class="flex justify-start align-center" @click="Mechanic = !Mechanic">
					<view class="text-sm text-999 margin-right-xs">
						<text v-show="Mechanic">收起</text>
						<text v-show="!Mechanic">展开</text>
					</view>
					<image :src="baseUrl + '/static/down2.png'" v-show="Mechanic" mode=""
						style="width: 14rpx; height: 14rpx"></image>
					<image :src="baseUrl + '/static/up2.png'" v-show="!Mechanic" mode=""
						style="width: 14rpx; height: 14rpx"></image>
				</view>
			</view>
			<view class="cu-list grid col-5 no-border" style="margin-top: 60rpx; padding: 0" v-show="Mechanic">
				<view @click="
            toPage('/filePage/pages/certification-center/mechanic/mechanic')
          " class="cu-item flex flex-direction justify-center align-center" style="padding: 0">
					<view class="" :style="
              'background-image:url(' +
              baseUrl +
              '/static/attest.png);width: 48rpx;height: 48rpx;background-size: 100% 100%;'
            ">
						<!-- <view class="cu-tag badge">
							<block v-if="item.badge!=1">{{item.badge>99?'99+':item.badge}}</block>
							<block>99+</block>
						</view> -->
					</view>
					<text class="text-sm margin-top">我的认证</text>
				</view>
				<view v-if="userInfo.shopIdMechanic" @click="
            toPage(
              '/filePage/pages/certification-center/service-center/service-center?id=' +
                userInfo.shopIdMechanic
            )
          " class="cu-item flex flex-direction justify-center align-center" style="padding: 0">
					<view class="" :style="
              'background-image:url(' +
              baseUrl +
              '/static/Service_provider2.png);'
            " style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">我的服务商</text>
				</view>
				<view v-else @click="
            toPage(
              '/pagesA/pages/serviceUserList/serviceUserList?id=' +
                userInfo.shopIdMechanic
            )
          " class="cu-item flex flex-direction justify-center align-center" style="padding: 0">
					<view class="" :style="
              'background-image:url(' +
              baseUrl +
              '/static/Service_provider2.png);'
            " style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">我的服务商</text>
				</view>

				<view @click="toPage('/filePage/pages/dispatch/dispatch')"
					class="cu-item flex flex-direction justify-center align-center" style="padding: 0">
					<view class="" :style="
              'background-image:url(' +
              baseUrl +
              '/static/Dispatch_management.png);'
            " style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">我的派单</text>
				</view>
			</view>
		</view>
		<view class="margin-sm padding bg-white radius10" v-if="userInfo.courierStatus">
			<view class="flex justify-between align-center">
				<view class="text-15 text-bold text-221815"> 配送工管理 </view>
				<view class="flex justify-start align-center" @click="Delivery = !Delivery">
					<view class="text-sm text-999 margin-right-xs">
						<text v-show="Delivery">收起</text>
						<text v-show="!Delivery">展开</text>
					</view>
					<image :src="baseUrl + '/static/down2.png'" v-show="Delivery" mode=""
						style="width: 14rpx; height: 14rpx"></image>
					<image :src="baseUrl + '/static/up2.png'" v-show="!Delivery" mode=""
						style="width: 14rpx; height: 14rpx"></image>
				</view>
			</view>
			<view v-show="Delivery" class="cu-list grid col-5 no-border" style="margin-top: 60rpx; padding: 0">
				<view @click="
            toPage(
              '/filePage/pages/certification-center/delivery-worker/delivery-worker'
            )
          " class="cu-item flex flex-direction justify-center align-center" style="padding: 0">
					<view class="" :style="
              'background-image:url(' +
              baseUrl +
              '/static/attest.png);width: 48rpx;height: 48rpx;background-size: 100% 100%;'
            ">
						<!-- <view class="cu-tag badge">
							<block v-if="item.badge!=1">{{item.badge>99?'99+':item.badge}}</block>
							<block>99+</block>
						</view> -->
					</view>
					<text class="text-sm margin-top">我的认证</text>
				</view>
				<view v-if="userInfo.shopIdCourier" @click="
            toPage(
              '/filePage/pages/certification-center/service-center/service-center?id=' +
                userInfo.shopIdCourier
            )
          " class="cu-item flex flex-direction justify-center align-center" style="padding: 0">
					<view class="" :style="
              'background-image:url(' +
              baseUrl +
              '/static/Service_provider2.png);'
            " style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">我的服务商</text>
				</view>
				<view v-else @click="
            toPage(
              '/pagesA/pages/serviceUserList/deliverList?id=' +
                userInfo.shopIdCourier
            )
          " class="cu-item flex flex-direction justify-center align-center" style="padding: 0">
					<view class="" :style="
              'background-image:url(' +
              baseUrl +
              '/static/Service_provider2.png);'
            " style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">我的服务商</text>
				</view>
				<!-- <view @click="toPage('/filePage/pages/dispatch/dispatch')"
					class="cu-item flex flex-direction justify-center align-center" style="padding: 0;">
					<view class="" :style="'background-image:url('+ baseUrl +'/static/Dispatch_management.png);'"
						style="width: 48rpx;height: 48rpx;background-size: 100% 100%;">

					</view>
					<text class="text-sm margin-top">我的派单</text>
				</view> -->
			</view>
		</view>
		<view class="margin-sm padding bg-white radius10" v-if="userInfo.providerStatus">
			<view class="flex justify-between align-center">
				<view class="text-15 text-bold text-221815"> 服务商管理 </view>
				<view class="flex justify-start align-center" @click="service = !service">
					<view class="text-sm text-999 margin-right-xs">
						<text v-show="service">收起</text>
						<text v-show="!service">展开</text>
					</view>
					<image :src="baseUrl + '/static/down2.png'" v-show="service" mode=""
						style="width: 14rpx; height: 14rpx"></image>
					<image :src="baseUrl + '/static/up2.png'" v-show="!service" mode=""
						style="width: 14rpx; height: 14rpx"></image>
				</view>
			</view>
			<view v-show="service" class="cu-list grid col-5 no-border" style="padding: 0">
				<view @click="
            toPage(
              '/filePage/pages/certification-center/service-center/service-center'
            )
          " class="cu-item flex flex-direction justify-center align-center" style="padding: 0; margin-top: 60rpx">
					<view class="" :style="'background-image:url(' + baseUrl + '/static/attest.png);'"
						style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
						<!-- <view class="cu-tag badge">
							<block v-if="item.badge!=1">{{item.badge>99?'99+':item.badge}}</block>
							<block>99+</block>
						</view> -->
					</view>
					<text class="text-sm margin-top">我的认证</text>
				</view>
				<view v-if="userInfo.shopIdToCenter" @click="
            toPage(
              '/filePage/pages/certification-center/operator/operator?id=' +
                userInfo.shopIdToCenter
            )
          " class="cu-item flex flex-direction justify-center align-center" style="padding: 0; margin-top: 60rpx">
					<view class="" :style="
              'background-image:url(' + baseUrl + '/static/operator2.png);'
            " style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
						<!-- <view class="cu-tag badge">
							<block v-if="item.badge!=1">{{item.badge>99?'99+':item.badge}}</block>
							<block>99+</block>
						</view> -->
					</view>
					<text class="text-sm margin-top">我的运营商</text>
				</view>
				<view v-else @click="
            toPage(
              '/filePage/pages/operator-list/operator-list?shopId=' +
                userInfo.shopIdApply
            )
          " class="cu-item flex flex-direction justify-center align-center" style="padding: 0; margin-top: 60rpx">
					<view class="" :style="
              'background-image:url(' + baseUrl + '/static/operator2.png);'
            " style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
						<!-- <view class="cu-tag badge">
							<block v-if="item.badge!=1">{{item.badge>99?'99+':item.badge}}</block>
							<block>99+</block>
						</view> -->
					</view>
					<text class="text-sm margin-top">我的运营商</text>
				</view>
				<view @click="
            toPage('/filePage/pages/service-mechanic/service-mechanic?type=1')
          " class="cu-item flex flex-direction justify-center align-center" style="padding: 0; margin-top: 60rpx">
					<view class="" :style="
              'background-image:url(' + baseUrl + '/static/Mechanic2.png);'
            " style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">技工</text>
				</view>
				<view @click="toPage('/filePage/pages/distribution/distribution')"
					class="cu-item flex flex-direction justify-center align-center"
					style="padding: 0; margin-top: 60rpx">
					<view class="" :style="
              'background-image:url(' +
              baseUrl +
              '/static/Delivery_worker2.png);'
            " style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">配送工</text>
				</view>
				<view @click="toPage('/filePage/pages/center/center?type=1')"
					class="cu-item flex flex-direction justify-center align-center"
					style="padding: 0; margin-top: 60rpx">
					<view class="" :style="
              'background-image:url(' +
              baseUrl +
              '/static/Dispatch_management.png);'
            " style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">派单中心</text>
				</view>
				<view @click="toPage('/filePage/pages/issue/issue?type=1')"
					class="cu-item flex flex-direction justify-center align-center"
					style="padding: 0; margin-top: 60rpx">
					<view class="" :style="'background-image:url(' + baseUrl + '/static/Billing.png);'"
						style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">我要发单</text>
				</view>
				<view @click="toPage('/filePage/pages/productList/productList?type=1')"
					class="cu-item flex flex-direction justify-center align-center"
					style="padding: 0; margin-top: 60rpx">
					<view class="" :style="
              'background-image:url(' + baseUrl + '/static/commodity.png);'
            " style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">商品管理</text>
				</view>
				<view @click="toPage('/filePage/pages/group-buy/group-buy?type=1')"
					class="cu-item flex flex-direction justify-center align-center"
					style="padding: 0; margin-top: 60rpx">
					<view class="" :style="'background-image:url(' + baseUrl + '/static/group3.png);'"
						style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">团购商品</text>
				</view>
				<view @click="toPage('/filePage/pages/service-purchase/service-purchase')"
					class="cu-item flex flex-direction justify-center align-center"
					style="padding: 0; margin-top: 60rpx">
					<view class="" :style="
              'background-image:url(' + baseUrl + '/static/purchase.png);'
            " style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">我要采购</text>
				</view>
				<view @click="toPage('/filePage/pages/coupon-list/coupon-list?type=1')"
					class="cu-item flex flex-direction justify-center align-center"
					style="padding: 0; margin-top: 60rpx">
					<view class="" :style="'background-image:url(' + baseUrl + '/static/coupon2.png);'"
						style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">优惠券设置</text>
				</view>
				<view @click="toPage('/pagesA/pages/serviceProducList/serviceProducList')"
					class="cu-item flex flex-direction justify-center align-center"
					style="padding: 0; margin-top: 60rpx">
					<view class="" :style="'background-image:url(' + baseUrl + '/static/good.png);'"
						style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">商品订单</text>
				</view>
			</view>
		</view>

		<view class="margin-sm padding bg-white radius10" v-if="userInfo.operatorStauts">
			<view class="flex justify-between align-center">
				<view class="text-15 text-bold text-221815"> 运营中心管理 </view>
				<view class="flex justify-start align-center" @click="Operation = !Operation">
					<view class="text-sm text-999 margin-right-xs">
						<text v-show="Operation">收起</text>
						<text v-show="!Operation">展开</text>
					</view>
					<image :src="baseUrl + '/static/down2.png'" v-show="Operation" mode=""
						style="width: 14rpx; height: 14rpx"></image>
					<image :src="baseUrl + '/static/up2.png'" v-show="!Operation" mode=""
						style="width: 14rpx; height: 14rpx"></image>
				</view>
			</view>
			<view v-show="Operation" class="cu-list grid col-5 no-border" style="padding: 0">
				<view @click="
            toPage('/filePage/pages/certification-center/operator/operator')
          " class="cu-item flex flex-direction justify-center align-center" style="padding: 0; margin-top: 60rpx">
					<view class="" :style="'background-image:url(' + baseUrl + '/static/attest.png);'"
						style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
						<!-- <view class="cu-tag badge">
							<block v-if="item.badge!=1">{{item.badge>99?'99+':item.badge}}</block>
							<block>99+</block>
						</view> -->
					</view>
					<text class="text-sm margin-top">我的认证</text>
				</view>
				<view @click="
            toPage(
              '/pagesA/pages/serviceUserList/serviceList/serviceList?shopId=' +
                userInfo.shopServiceIdApply
            )
          " class="cu-item flex flex-direction justify-center align-center" style="padding: 0; margin-top: 60rpx">
					<view class="" :style="
              'background-image:url(' +
              baseUrl +
              '/static/Service_provider2.png);'
            " style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">我的服务商</text>
				</view>
				<view @click="toPage('/filePage/pages/coupon-list/coupon-list?type=2')"
					class="cu-item flex flex-direction justify-center align-center"
					style="padding: 0; margin-top: 60rpx">
					<view class="" :style="'background-image:url(' + baseUrl + '/static/coupon2.png);'"
						style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">优惠券设置</text>
				</view>
				<view class="cu-item flex flex-direction justify-center align-center"
					style="padding: 0; margin-top: 60rpx" @click="toPage('/filePage/pages/center/center?type=2')">
					<view class="" :style="
              'background-image:url(' +
              baseUrl +
              '/static/Dispatch_management.png);'
            " style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">派单中心</text>
				</view>
				<view @click="toPage('/filePage/pages/issue/issue?type=2')"
					class="cu-item flex flex-direction justify-center align-center"
					style="padding: 0; margin-top: 60rpx">
					<view class="" :style="'background-image:url(' + baseUrl + '/static/Billing.png);'"
						style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">我要发单</text>
				</view>
				<view @click="toPage('/filePage/pages/productList/productList?type=2')"
					class="cu-item flex flex-direction justify-center align-center"
					style="padding: 0; margin-top: 60rpx">
					<view class="" :style="
              'background-image:url(' + baseUrl + '/static/commodity.png);'
            " style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">商品管理</text>
				</view>
				<view @click="toPage('/filePage/pages/group-buy/group-buy?type=2')"
					class="cu-item flex flex-direction justify-center align-center"
					style="padding: 0; margin-top: 60rpx">
					<view class="" :style="'background-image:url(' + baseUrl + '/static/group3.png);'"
						style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">团购商品</text>
				</view>
				<view @click="toPage('/filePage/pages/service-purchase/service-purchase')"
					class="cu-item flex flex-direction justify-center align-center"
					style="padding: 0; margin-top: 60rpx">
					<view class="" :style="
              'background-image:url(' + baseUrl + '/static/purchase.png);'
            " style="width: 48rpx; height: 48rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">我要采购</text>
				</view>
			</view>
		</view>
		<view class="margin-sm bg-white radius10" style="padding: 30upx 0">
			<view class="flex justify-between align-center">
				<view class="text-15 text-bold text-221815" style="padding: 0 30upx">
					常用工具
				</view>
			</view>
			<view class="cu-list grid col-4 no-border" style="padding: 0">
				<view @click="
            toPage('/filePage/pages/common-tools/coupon-center/coupon-center')
          " class="cu-item flex flex-direction justify-center align-center" style="padding: 0; margin-top: 44rpx">
					<view class="" :style="'background-image:url(' + baseUrl + '/static/Coupon.png);'"
						style="width: 56rpx; height: 56rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">领券中心</text>
				</view>
				<view @click="toPage('/filePage/pages/common-tools/promote/promote')"
					class="cu-item flex flex-direction justify-center align-center"
					style="padding: 0; margin-top: 44rpx">
					<view class="" :style="'background-image:url(' + baseUrl + '/static/Promote.png);'"
						style="width: 56rpx; height: 56rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">我要推广</text>
				</view>
				<view @click="toPage('/filePage/pages/customer/customer')"
					class="cu-item flex flex-direction justify-center align-center"
					style="padding: 0; margin-top: 44rpx">
					<view class="" :style="
              'background-image:url(' +
              baseUrl +
              '/static/Customer_service.png);'
            " style="width: 56rpx; height: 56rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">联系客服</text>
				</view>
				<view @click="toPage('/filePage/pages/help-center/help-center')"
					class="cu-item flex flex-direction justify-center align-center"
					style="padding: 0; margin-top: 44rpx">
					<view class="" :style="'background-image:url(' + baseUrl + '/static/help.png);'"
						style="width: 56rpx; height: 56rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">帮助中心</text>
				</view>
				<view @click="
            toPage('/filePage/pages/businessschool-order/businessschool-order')
          " class="cu-item flex flex-direction justify-center align-center" style="padding: 0; margin-top: 44rpx">
					<view class="" :style="'background-image:url(' + baseUrl + '/static/College.png);'"
						style="width: 56rpx; height: 56rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">商学院</text>
				</view>
				<view @click="toPage('/filePage/pages/setting/setting')"
					class="cu-item flex flex-direction justify-center align-center"
					style="padding: 0; margin-top: 44rpx">
					<view class="" :style="'background-image:url(' + baseUrl + '/static/Set_up.png);'"
						style="width: 56rpx; height: 56rpx; background-size: 100% 100%">
					</view>
					<text class="text-sm margin-top">设置</text>
				</view>
			</view>
		</view>
		<view class="cu-tabbar-height"></view>
		<view class="cu-modal" :class="modalName == 'ModalAuthor' ? 'show' : ''">
			<view class="cu-dialog bg-white">
				<view class="cu-bar justify-end">
					<view class="content">提示</view>
				</view>
				<view class="padding-xl text-20"> 请先授权登录 </view>
				<view class="flex justify-between align-center padding text-lg">
					<view @click="hideModal" class="bg-D7D7D7 text-gray radius5" style="padding: 32rpx 96rpx">
						取消
					</view>
					<button v-if="canIUseProfile == false" open-type="getUserInfo" @getuserinfo="getUserInfo"
						class="bg-color text-white radius5" style="padding: 32rpx 96rpx">
						确定
					</button>
					<button v-else @tap="getUserInfo" class="bg-color text-white radius5" style="padding: 32rpx 96rpx">
						确定
					</button>
				</view>
			</view>
		</view>
		<view class="cu-modal" :class="{ show: isShow }">
			<view class="cu-dialog bg-white">
				<view class="cu-bar justify-end">
					<view class="content">提示</view>
				</view>
				<view class="padding-xl text-20"> 获取用户手机号 </view>
				<view class="flex justify-between align-center padding text-lg">
					<view @click="isShow = false" class="bg-D7D7D7 text-gray radius5" style="padding: 32rpx 96rpx">
						取消
					</view>
					<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"
						class="bg-color text-white radius5" style="padding: 32rpx 96rpx">
						确定
					</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				baseUrl: this.$config.baseUrl,
				StatusBar: this.StatusBar,
				Operation: false,
				service: false,
				Delivery: false,
				Mechanic: false,
				userInfo: {
					balance: 0,
				},
				modalName: null,
				latitude: "",
				longitude: "",
				canIUseProfile: false,
				recommendCode: "",
				competitiveCount: 0,
				courierCount: 0,
				groupBuyCount: 0,
				orderServiceCount: 0,
				productCount: 0,
				screenCount: 0,
				userId: "",
				isShow: false,
				session_key: "",
				phoneNumber: "",
				isLogin: false,
				is_flag: "",
			};
		},
		onLoad(option) {
			if (wx.getUserProfile) {
				console.log("--check getUserProfile--OK");
				this.canIUseProfile = true;
				console.log(this.canIUseProfile)
			}
			if (option.scene) {
				const scene = decodeURIComponent(option.scene);
				uni.setStorageSync('scene',scene)
				this.recommendCode = scene
				console.log(this.recommendCode)
				
			}
		},
		onShow() {
			// if(uni.getStorageSync('mobile')){
			// 	this.phoneNumber = uni.getStorageSync('mobile')
			// }
			this.getFlag();

			let that = this;
			uni.getLocation({
				type: "gcj02",
				success: function(res) {
					that.latitude = res.latitude;
					that.longitude = res.longitude;
				},
				fail: function(err) {
					that.$util.msg("请允许定位");
					setTimeout(() => {
						uni.switchTab({
							url: "/pages/home/home",
						});
					}, 1500);
				},
			});
			uni.getStorage({
				key: "userId",
				success: function() {
					that.getUser();
					that.isLogin = true
					console.log(111)
					// if (!that.phoneNumber) {
					// 	that.isShow = true
					// }
				},
				fail() {
					console.log(111)
					// #ifdef  APP-PLUS
					Object.assign(that.$data, that.$options.data());
					// #endif


				}
			});
		},
		onPullDownRefresh() {

			let that = this;
			uni.getLocation({
				type: "gcj02",
				success: function(res) {
					that.latitude = res.latitude;
					that.longitude = res.longitude;
				},
				fail: function(err) {
					that.$util.msg("请允许定位");
					setTimeout(() => {
						uni.switchTab({
							url: "/pages/home/home",
						});
					}, 1500);
				},
			});
			uni.getStorage({
				key: "userId",
				success: function() {
					that.getUser();
					console.log(111)
					// if (!that.phoneNumber) {
					// 	that.isShow = true
					// }
				},
				fail() {
					// // #ifdef  APP-PLUS
					//   Object.assign(that.$data, that.$options.data());
					// // #endif


				}
			});
			uni.stopPullDownRefresh();
		},
		methods: {
			async getFlag() {
				const [err, res] = await this.$get(this.$api.hiddenFlag);
				if (res) {
					this.is_flag = res.data;
					// #ifdef MP-WEIXIN
					if (res.data) {
						uni.showTabBar();
					}
					// #endif

					uni.setStorage({
						key: "is_flag",
						data: res.data,
					})
				}
			},
			toPage(url) {
				let that = this;
				uni.getStorage({
					key: "userId",
					success: function() {
						that.$util.openNewPage(url);
						// if (!that.phoneNumber) {

						// 	that.isShow = true
						// } else {
						// 	that.$util.openNewPage(url)
						// }
					},
					fail: function() {
						// #ifdef MP-WEIXIN
						that.modalName = "ModalAuthor";
						// #endif
						// #ifdef APP-PLUS
						uni.navigateTo({
							url: "/pages/login/login",
						});
						// #endif
					},
				});
			},
			hideModal() {
				this.modalName = null;
				// uni.switchTab({
				// 	url: '/pages/home/home'
				// })
			},
			async getUserInfo() {
				let that = this;
				// this.hideModal()
				this.modalName = null;
				console.log(this.canIUseProfile)


				if (that.canIUseProfile == false) {
					uni.login({
						provider: "weixin",
						success: function(loginRes) {
							console.log(loginRes);
							uni.getUserInfo({
								provider: "weixin",
								success: function(res) {
									that.getLogin(
										loginRes.code,
										res.userInfo.nickName,
										res.userInfo.avatarUrl
									);
								},
							});
						},
					});
				} else {
					console.log(1111);
					uni.getUserProfile({
						desc: "Wexin",
						success: function(res) {
							console.log("wx.getUserProfile=>用户允许了授权");
							console.log(res.userInfo);
							// console.log( res.rawData );
							console.log(res.signature);
							console.log(res.encryptedData);
							console.log(res.iv);
							uni.login({
								provider: "weixin",
								success: function(loginRes) {
									console.log(loginRes);
									that.getLogin(
										loginRes.code,
										res.userInfo.nickName,
										res.userInfo.avatarUrl
									);
								},
							});
						},
						fail(rs) {
							console.log(rs);
						},
					});
				}
			},
			async getLogin(code, nickName, avatarUrl) {
				uni.showLoading({
					title: "正在登录",
					mask: true,
				});
				const data = {
					code: code,
					nickname: nickName,
					headimg: avatarUrl,
					latitude: this.latitude,
					longitude: this.longitude,
				};
				if (this.recommendCode) {
					data["recommendCode"] = this.recommendCode;
				}
				const [err, res] = await this.$post(this.$api.loginWX, data);
				if (res) {
					console.log(res)
					// uni.clearStorage();
					// try {
					//     uni.clearStorageSync();
					// } catch (e) {
					//     // error
					// }
					// console.log(res)
					this.isShow = true;
					this.isLogin = true
					this.session_key = res.data.session_key;
					uni.setStorage({
						key: "session_key",
						data: res.data.session_key,
					});
					uni.setStorage({
						key: "openid",
						data: res.data.openid,
					});
					uni.setStorage({
						key: "token",
						data: res.data.openid,
					});
					// 73
					uni.setStorage({
						key: "userId",
						data: res.data.userId,
					});
					uni.hideLoading();
					this.userId = res.data.userId;
					this.$util.msg(res.message);
					this.getUser();
				}
			},
			async getAddress(longitude, latitude) {
				const [err, res] = await this.$get(this.$api.home_position, {
					longitude: longitude,
					latitude: latitude,
					coordinateType: "gcj02ll",
				});
				if (res) {
					this.address = res.data.address;
					// console.log(res)
				}
			},
			async getUser() {
				const data = {
					userId: uni.getStorageSync("userId"),
				};
				const [err, rs] = await this.$get(this.$api.userDetail, data);
				if (rs) {
					console.log(rs);
					this.userInfo = rs.data;
					uni.setStorageSync("userInfo", rs.data);
					if (rs.data.shopIdApply) {
						uni.setStorageSync("shopIdApply", rs.data.shopIdApply);
					}

					if (rs.data.shopServiceIdApply) {
						uni.setStorageSync("shopServiceIdApply", rs.data.shopServiceIdApply);
					}
					console.log(this.userInfo);

					let [error, res] = await this.$get(this.$api.orderCount, {
						userId: uni.getStorageSync("userId"),
					});
					if (res) {
						console.log(res);
						this.competitiveCount = res.data.competitiveCount;
						this.courierCount = res.data.courierCount;
						this.groupBuyCount = res.data.groupBuyCount;
						this.orderServiceCount = res.data.orderServiceCount;
						this.productCount = res.data.productCount;
						this.screenCount = res.data.screenCount;
					}
				}
			},
			async getPhoneNumber(e) {
				this.isShow = false;
				console.log(e);
				var iv = e.detail.iv;
				var encryptedData = e.detail.encryptedData;
				var session_key;
				if (uni.getStorageSync("session_key")) {
					session_key = uni.getStorageSync("session_key");
				} else {
					session_key = this.session_key;
				}
				const data = {
					session_key,
					iv,
					encryptedData,
				};
				const [err, rs] = await this.$get(this.$api.getWXPhone, data);
				if (rs) {
					this.$util.msg(rs.message);
					this.phoneNumber = rs.data.mobile;
					uni.setStorageSync("mobile", rs.data.mobile);
				}
			},
		},
	};
</script>

<style lang="scss" scoped>
	.f_header {
		height: 242rpx;

		background-size: 100% 100%;
	}

	.cu-avatar {
		background: inherit;
		background-size: cover;
	}

	.scroll {
		width: 710upx;
		background: #ffffff;
		white-space: nowrap;
		padding: 0 20upx;

		.item {
			padding: 30upx 0;
			text-align: center;
			margin-right: 30upx;
			vertical-align: top;
			display: inline-block;

			&:nth-last-of-type(1) {
				margin-right: 0;
			}
		}

		.cu-tag.badge {
			line-height: 28upx;
		}
	}

	.cu-list.grid>.cu-item text {
		color: #333333;
	}
</style>
